package com.wu.pojo.dto;

import com.wu.pojo.bean.PaperQuestionAddBean;
import com.wu.pojo.po.paperPo.Paper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("新增问卷DTO")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@SuppressWarnings("ALL")
public class PaperAddDTO  implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("机构名称")
    @NotNull(message = "问卷标题不能为空")
    @Size(min = 2, max = 32, message = "问卷标题在2个字符到64个字符之间")
    private String title;

    @ApiModelProperty("问卷发布状态")
    @NotNull(message = "问卷发布状态不能为空")
    private String status;

    @ApiModelProperty("问卷描述")
    @NotNull(message = "问卷描述不能为空")
    private String descri;

    @ApiModelProperty("问卷问题")
    @NotNull(message = "问卷问题不能为空")
    private List<PaperQuestionAddBean> questions;

    @ApiModelProperty("开始时间")
    private String startTime;

    @ApiModelProperty("截止时间")
    private String endTime;

    @ApiModelProperty("备用参数")
    private String remark;

    public Paper paperInit(){//初始化参数
        Paper paper = new Paper();
        paper.setTitle(title).
                setDescri(descri).setStatus(status).setCreateTime(new Date()).setRemark(remark);
        return paper;
    }
}
